<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
	Message msg = new Message();
	//获取检验记录
	String cardNumber = input.getDesc("cardNumber","320211194008272514");//身份证号
	String patientName = input.getDesc("patientName","包洪生");
	
	StringBuffer sb = new StringBuffer();
		sb.append("'-20'");
	List<Map> list = QBuilder.db("basedb").queryHql("select new map(blh as blh) from ZY_BRXXK where sfzh = '"+cardNumber+"' and hzxm = '"+ patientName +"' ");
	if(list == null || list.size() == 0){//没有去门诊查
		list = QBuilder.db("basedb").queryHql("select new map(blh as blh) from SF_BRXXK where sfzh = '"+cardNumber+"' and hzxm = '"+ patientName +"' ");
	}else{
		
		if(list !=null && list.size() != 0 ){
			 for(Map map : list){
				 sb.append(",");
				 sb.append("'");
				 sb.append(map.get("blh").toString());
				 sb.append("'");
			 }
			 
		}
		list = QBuilder.db("basedb").queryHql("select new map(blh as blh) from SF_BRXXK where sfzh = '"+cardNumber+"' and hzxm = '"+ patientName +"' ");
	}
	if(list !=null && list.size() != 0 ){
			 for(Map map : list){
				 sb.append(",");
				 sb.append("'");
				 sb.append(map.get("blh").toString());
				 sb.append("'");
			 }
			 
	}
	if(sb.toString().equals("'-20'")){//没有去门诊查
		msg.put("errcode",30041);
		msg.put("errmsg","暂无数据");
		
		out.println(msg);
		return;
	}
	

	
	List lis = QBuilder.db("lisdb").queryHql("select new map (regNo as regNo , reportNo as reportNo ,applyDate as applyDate , executDate as executDate , reportDate as reportDate , testCategCode as testCategCode , testCategName as testCategName , doctorCode as doctorCode , doctorName as doctorName ) from check where blh in(" + sb.toString() + ")");
	
	msg.put("errcode",0);
	msg.put("data",lis);
	out.println(msg);
%>